package com.bootdo.slideshow.service.impl;

import com.bootdo.common.redisUtils.JedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.bootdo.slideshow.dao.CommonsSlideshowDao;
import com.bootdo.slideshow.domain.CommonsSlideshow;
import com.bootdo.slideshow.service.CommonsSlideshowService;



@Service
public class CommonsSlideshowServiceImpl implements CommonsSlideshowService {
	@Autowired
	private CommonsSlideshowDao commonsSlideshowDao;
	
	@Override
	public CommonsSlideshow get(Integer id){
		return commonsSlideshowDao.get(id);
	}
	
	@Override
	public List<CommonsSlideshow> list(Map<String, Object> map){
		return commonsSlideshowDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return commonsSlideshowDao.count(map);
	}
	
	@Override
	public int save(CommonsSlideshow commonsSlideshow){
		if(JedisUtils.exists("jsonLunbotop")){
			JedisUtils.del("jsonLunbotop");
		}
		if(commonsSlideshow.getId() != null) {

			return commonsSlideshowDao.update(commonsSlideshow);
		}else {
			return commonsSlideshowDao.save(commonsSlideshow);
		}		
	
		
	}
	
	@Override
	public int update(CommonsSlideshow commonsSlideshow){
		return commonsSlideshowDao.update(commonsSlideshow);
	}
	
	@Override
	public int remove(Integer id){
		if(JedisUtils.exists("jsonLunbotop")){
			JedisUtils.del("jsonLunbotop");
		}
		return commonsSlideshowDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		if(JedisUtils.exists("jsonLunbotop")){
			JedisUtils.del("jsonLunbotop");
		}
		return commonsSlideshowDao.batchRemove(ids);
	}
	
}
